class Modle{
    constructor(data,message){
        if(typeof data==="string"){
            this.message=data
        }else{
            if(data) this.data=data;
            if(message) this.message=message
        }
    }
}


class SuccessModle extends Modle{
    constructor(data,message){
        super(data,message)
        this.code=1
    }
}

class ErrorModle extends Modle{
    constructor(message){
        super(message)
        this.code=-1
    }
}

function success(data,message){
    return new SuccessModle(data,message)
}

function error(message){
    return new ErrorModle(message)
}
module.exports={
    success,
    error
}
